{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import plotly.graph_objects as go\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv('./data/mt_bruno_elevation.csv')\n",
    "del data['index']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "      <th>16</th>\n",
       "      <th>17</th>\n",
       "      <th>18</th>\n",
       "      <th>19</th>\n",
       "      <th>20</th>\n",
       "      <th>21</th>\n",
       "      <th>22</th>\n",
       "      <th>23</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>27.809850</td>\n",
       "      <td>49.61936</td>\n",
       "      <td>83.080670</td>\n",
       "      <td>116.66320</td>\n",
       "      <td>130.41400</td>\n",
       "      <td>150.72060</td>\n",
       "      <td>220.1871</td>\n",
       "      <td>156.1536</td>\n",
       "      <td>148.6416</td>\n",
       "      <td>203.7845</td>\n",
       "      <td>...</td>\n",
       "      <td>49.96142</td>\n",
       "      <td>21.89279</td>\n",
       "      <td>17.02552</td>\n",
       "      <td>11.743170</td>\n",
       "      <td>14.752260</td>\n",
       "      <td>13.667100</td>\n",
       "      <td>5.677561</td>\n",
       "      <td>3.312340</td>\n",
       "      <td>1.156517</td>\n",
       "      <td>-0.147662</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>27.719660</td>\n",
       "      <td>48.55022</td>\n",
       "      <td>65.213740</td>\n",
       "      <td>95.27666</td>\n",
       "      <td>116.99640</td>\n",
       "      <td>133.90560</td>\n",
       "      <td>152.3412</td>\n",
       "      <td>151.9340</td>\n",
       "      <td>160.1139</td>\n",
       "      <td>179.5327</td>\n",
       "      <td>...</td>\n",
       "      <td>33.08871</td>\n",
       "      <td>38.40972</td>\n",
       "      <td>44.24843</td>\n",
       "      <td>69.578600</td>\n",
       "      <td>4.019351</td>\n",
       "      <td>3.050024</td>\n",
       "      <td>3.039719</td>\n",
       "      <td>2.996142</td>\n",
       "      <td>2.967954</td>\n",
       "      <td>1.999594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>30.426700</td>\n",
       "      <td>33.47752</td>\n",
       "      <td>44.809530</td>\n",
       "      <td>62.47495</td>\n",
       "      <td>77.43523</td>\n",
       "      <td>104.21530</td>\n",
       "      <td>102.7393</td>\n",
       "      <td>137.0004</td>\n",
       "      <td>186.0706</td>\n",
       "      <td>219.3173</td>\n",
       "      <td>...</td>\n",
       "      <td>48.47132</td>\n",
       "      <td>74.71461</td>\n",
       "      <td>60.09090</td>\n",
       "      <td>7.073525</td>\n",
       "      <td>6.089851</td>\n",
       "      <td>6.537450</td>\n",
       "      <td>6.666096</td>\n",
       "      <td>7.306965</td>\n",
       "      <td>5.736840</td>\n",
       "      <td>3.625628</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>16.665490</td>\n",
       "      <td>30.10860</td>\n",
       "      <td>39.969520</td>\n",
       "      <td>44.12225</td>\n",
       "      <td>59.57512</td>\n",
       "      <td>77.56929</td>\n",
       "      <td>106.8925</td>\n",
       "      <td>166.5539</td>\n",
       "      <td>175.2381</td>\n",
       "      <td>185.2815</td>\n",
       "      <td>...</td>\n",
       "      <td>60.55916</td>\n",
       "      <td>55.92124</td>\n",
       "      <td>15.17284</td>\n",
       "      <td>8.248324</td>\n",
       "      <td>36.680870</td>\n",
       "      <td>61.934130</td>\n",
       "      <td>20.268670</td>\n",
       "      <td>68.588190</td>\n",
       "      <td>46.498120</td>\n",
       "      <td>0.236009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>8.815617</td>\n",
       "      <td>18.35160</td>\n",
       "      <td>8.658275</td>\n",
       "      <td>27.58590</td>\n",
       "      <td>48.62691</td>\n",
       "      <td>60.18013</td>\n",
       "      <td>91.3286</td>\n",
       "      <td>145.7109</td>\n",
       "      <td>116.0653</td>\n",
       "      <td>106.2662</td>\n",
       "      <td>...</td>\n",
       "      <td>47.42691</td>\n",
       "      <td>69.20731</td>\n",
       "      <td>44.95468</td>\n",
       "      <td>29.171970</td>\n",
       "      <td>17.916740</td>\n",
       "      <td>16.255150</td>\n",
       "      <td>14.655590</td>\n",
       "      <td>17.260480</td>\n",
       "      <td>31.222450</td>\n",
       "      <td>46.717040</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           0         1          2          3          4          5         6  \\\n",
       "0  27.809850  49.61936  83.080670  116.66320  130.41400  150.72060  220.1871   \n",
       "1  27.719660  48.55022  65.213740   95.27666  116.99640  133.90560  152.3412   \n",
       "2  30.426700  33.47752  44.809530   62.47495   77.43523  104.21530  102.7393   \n",
       "3  16.665490  30.10860  39.969520   44.12225   59.57512   77.56929  106.8925   \n",
       "4   8.815617  18.35160   8.658275   27.58590   48.62691   60.18013   91.3286   \n",
       "\n",
       "          7         8         9    ...            14        15        16  \\\n",
       "0  156.1536  148.6416  203.7845    ...      49.96142  21.89279  17.02552   \n",
       "1  151.9340  160.1139  179.5327    ...      33.08871  38.40972  44.24843   \n",
       "2  137.0004  186.0706  219.3173    ...      48.47132  74.71461  60.09090   \n",
       "3  166.5539  175.2381  185.2815    ...      60.55916  55.92124  15.17284   \n",
       "4  145.7109  116.0653  106.2662    ...      47.42691  69.20731  44.95468   \n",
       "\n",
       "          17         18         19         20         21         22         23  \n",
       "0  11.743170  14.752260  13.667100   5.677561   3.312340   1.156517  -0.147662  \n",
       "1  69.578600   4.019351   3.050024   3.039719   2.996142   2.967954   1.999594  \n",
       "2   7.073525   6.089851   6.537450   6.666096   7.306965   5.736840   3.625628  \n",
       "3   8.248324  36.680870  61.934130  20.268670  68.588190  46.498120   0.236009  \n",
       "4  29.171970  17.916740  16.255150  14.655590  17.260480  31.222450  46.717040  \n",
       "\n",
       "[5 rows x 24 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "height = data.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "surface = go.Surface(z = height)\n",
    "fig = go.Figure(surface)\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## customized surface"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.arange(-5, 6)\n",
    "y = np.arange(-5, 6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "xv, yv = np.meshgrid(x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5],\n",
       "       [-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5],\n",
       "       [-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4],\n",
       "       [-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3],\n",
       "       [-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2],\n",
       "       [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],\n",
       "       [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],\n",
       "       [ 1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1],\n",
       "       [ 2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2],\n",
       "       [ 3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3],\n",
       "       [ 4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4],\n",
       "       [ 5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5]])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "yv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[50, 41, 34, 29, 26, 25, 26, 29, 34, 41, 50],\n",
       "       [41, 32, 25, 20, 17, 16, 17, 20, 25, 32, 41],\n",
       "       [34, 25, 18, 13, 10,  9, 10, 13, 18, 25, 34],\n",
       "       [29, 20, 13,  8,  5,  4,  5,  8, 13, 20, 29],\n",
       "       [26, 17, 10,  5,  2,  1,  2,  5, 10, 17, 26],\n",
       "       [25, 16,  9,  4,  1,  0,  1,  4,  9, 16, 25],\n",
       "       [26, 17, 10,  5,  2,  1,  2,  5, 10, 17, 26],\n",
       "       [29, 20, 13,  8,  5,  4,  5,  8, 13, 20, 29],\n",
       "       [34, 25, 18, 13, 10,  9, 10, 13, 18, 25, 34],\n",
       "       [41, 32, 25, 20, 17, 16, 17, 20, 25, 32, 41],\n",
       "       [50, 41, 34, 29, 26, 25, 26, 29, 34, 41, 50]])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "z = xv**2 + yv**2\n",
    "z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "surface = go.Surface(x = xv, y = yv, z = z)\n",
    "fig = go.Figure(surface)\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
